package com.xuexiang.xuidemo.slice.progress;

import com.xuexiang.xui_lib.component.progress.materialprogressbar.MaterialCircleprogress;
import com.xuexiang.xui_lib.component.progress.materialprogressbar.MaterialHorizontalProgress;
import com.xuexiang.xuidemo.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.animation.Animator;
import ohos.agp.components.Component;
import ohos.agp.components.Image;

public class MaterialProgressBarSlice extends AbilitySlice {

    private MaterialHorizontalProgress materialHorizontalProgress1, materialHorizontalProgress2, materialHorizontalProgress3,
        materialHorizontalProgress4, materialHorizontalProgress5, materialHorizontalProgress6, materialHorizontalProgress7;
    private MaterialCircleprogress materialCircleprogress1, materialCircleprogress2, materialCircleprogress3,
        materialCircleprogress4, materialCircleprogress5, materialCircleprogress6
            , materialCircleprogress7, materialCircleprogress8, materialCircleprogress9;
    private Image image;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_slice_material_progress_bar);
        initView();
        setUpView();
    }

    private void initView() {
        image = (Image) findComponentById(ResourceTable.Id_slice_materialProgressBar_backImage);
        materialHorizontalProgress1 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView1);
        materialHorizontalProgress2 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView2);
        materialHorizontalProgress3 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView3);
        materialHorizontalProgress4 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView4);
        materialHorizontalProgress5 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView5);
        materialHorizontalProgress6 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView6);
        materialHorizontalProgress7 = (MaterialHorizontalProgress) findComponentById(ResourceTable.Id_HorizontalProgressView7);

        materialCircleprogress1 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView1);
        materialCircleprogress2 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView2);
        materialCircleprogress3 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView3);

        materialCircleprogress4 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView4);
        materialCircleprogress5 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView5);
        materialCircleprogress6 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView6);

        materialCircleprogress7 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView7);
        materialCircleprogress8 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView8);
        materialCircleprogress9 = (MaterialCircleprogress) findComponentById(ResourceTable.Id_CircleProgressView9);

    }

    private void setUpView() {
        image.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                terminate();
            }
        });

        materialCircleprogress1.setAnimateType(Animator.CurveType.OVERSHOOT);
        materialCircleprogress2.setAnimateType(Animator.CurveType.OVERSHOOT);
        materialCircleprogress3.setAnimateType(Animator.CurveType.OVERSHOOT);
        materialCircleprogress4.setAnimateType(Animator.CurveType.ACCELERATE_DECELERATE);
        materialCircleprogress5.setAnimateType(Animator.CurveType.ACCELERATE_DECELERATE);
        materialCircleprogress6.setAnimateType(Animator.CurveType.ACCELERATE_DECELERATE);
        materialCircleprogress7.setAnimateType(Animator.CurveType.ACCELERATE_DECELERATE);
        materialCircleprogress8.setAnimateType(Animator.CurveType.ACCELERATE_DECELERATE);
        materialCircleprogress9.setAnimateType(Animator.CurveType.ACCELERATE_DECELERATE);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    @Override
    protected void onStop() {
        super.onStop();
    }
}
